Themes should not enforce min sizes on blocks in continuous mode; in
this case, the filled block should be as large as it needs to be to
reflect the current value, and no larger or smaller than that. So, the
fact that the minimal size was selected on just levelbar block is wrong:
we should also require the levelbar.discrete class to apply min sizes.
The widget should enforce whatever correct minimum size results from the
above fix, by reapplying commit
78b4885fe8850e132d8bb06df8ab90ac6c2033e0
Except: we should not allocate/draw the filled block if the value is 0,
as in this case, the LevelBar should be empty, not have a min-size fill.
This partially reverts commit
96062ffeae5245fa165a96a2af86d5645f5e8569,
as it makes sense to set min sizes for discrete blocks, so keep that in.
https://bugzilla.gnome.org/show_bug.cgi?id=783649
gtk_widget_snapshot_child (widget, self->priv->block_widget[inverted ? 0 : 1], snapshot);
/* now render the filled part on top of it */
- gtk_widget_snapshot_child (widget, self->priv->block_widget[inverted ? 1 : 0], snapshot);
+ if (self->priv->cur_value != 0)
+ gtk_widget_snapshot_child (widget, self->priv->block_widget[inverted ? 1 : 0], snapshot);
}
else
{
GtkAllocation block_area, clip;
gdouble fill_percentage;
gboolean inverted;
+ int block_min;
inverted = gtk_level_bar_get_real_inverted (self);
baseline,
out_clip);
+ if (self->priv->cur_value == 0)
+ return;
+
/* now allocate the filled part */
block_area = *allocation;
fill_percentage = (self->priv->cur_value - self->priv->min_value) /
(self->priv->max_value - self->priv->min_value);
+ gtk_widget_measure (self->priv->block_widget[inverted ? 1 : 0],
+ self->priv->orientation, -1,
+ &block_min, NULL,
+ NULL, NULL);
+
if (self->priv->orientation == GTK_ORIENTATION_HORIZONTAL)
{
block_area.width = (gint) floor (block_area.width * fill_percentage);
+ block_area.width = MAX (block_area.width, block_min);
if (inverted)
block_area.x += allocation->width - block_area.width;
else
{
block_area.height = (gint) floor (block_area.height * fill_percentage);
+ block_area.height = MAX (block_area.height, block_min);
if (inverted)
block_area.y += allocation->height - block_area.height;
* Level Bar *
*************/
levelbar {
- block { min-height: 1px; }
+ &.horizontal {
+ block {
+ min-height: 1px;
+ }
+
+ &.discrete block {
+ margin: 0 1px;
+ min-width: 32px;
+ }
+ }
+
+ &.vertical {
+ block {
+ min-width: 1px;
+ }
- &.vertical block { min-width: 1px; }
+ &.discrete block {
+ margin: 1px 0;
+ min-height: 32px;
+ }
+ }
&:backdrop { transition: $backdrop_transition; }
&:backdrop { @include entry(backdrop); }
}
- &.horizontal.discrete block { margin: 0 1px; }
-
- &.vertical.discrete block { margin: 1px 0; }
-
block {
border: 1px solid;
border-radius: 1px;
progressbar trough.empty progress { all: unset; }
/************* Level Bar * */
-levelbar block { min-height: 1px; }
+levelbar.horizontal block { min-height: 1px; }
+
+levelbar.horizontal.discrete block { margin: 0 1px; min-width: 32px; }
levelbar.vertical block { min-width: 1px; }
+levelbar.vertical.discrete block { margin: 1px 0; min-height: 32px; }
+
levelbar:backdrop { transition: 200ms ease-out; }
levelbar trough { border: 1px solid; padding: 2px; border-radius: 3px; color: white; border-color: #1b1f20; background-color: #232729; box-shadow: inset 0 0 0 1px rgba(33, 93, 156, 0); }
levelbar trough:backdrop { color: #d3d4d5; border-color: #202425; background-color: #252a2c; box-shadow: none; }
-levelbar.horizontal.discrete block { margin: 0 1px; }
-
-levelbar.vertical.discrete block { margin: 1px 0; }
-
levelbar block { border: 1px solid; border-radius: 1px; }
levelbar block.low { border-color: #f57900; background-color: #f57900; }
progressbar trough.empty progress { all: unset; }
/************* Level Bar * */
-levelbar block { min-height: 1px; }
+levelbar.horizontal block { min-height: 1px; }
+
+levelbar.horizontal.discrete block { margin: 0 1px; min-width: 32px; }
levelbar.vertical block { min-width: 1px; }
+levelbar.vertical.discrete block { margin: 1px 0; min-height: 32px; }
+
levelbar:backdrop { transition: 200ms ease-out; }
levelbar trough { border: 1px solid; padding: 2px; border-radius: 3px; color: black; border-color: #b6b6b3; background-color: #ffffff; box-shadow: inset 0 0 0 1px rgba(74, 144, 217, 0); }
levelbar trough:backdrop { color: #323232; border-color: #c0c0bd; background-color: #fcfcfc; box-shadow: none; }
-levelbar.horizontal.discrete block { margin: 0 1px; }
-
-levelbar.vertical.discrete block { margin: 1px 0; }
-
levelbar block { border: 1px solid; border-radius: 1px; }
levelbar block.low { border-color: #8f4700; background-color: #f57900; }
@include entry(backdrop);
}
}
- & block {
- min-width: 32px;
- min-height: 1px;
+
+ &.horizontal {
+ block {
+ min-height: 1px;
+ }
+
+ &.discrete block {
+ margin: 0 1px;
+ min-width: 32px;
+ }
}
- &.vertical block {
- min-width: 1px;
- min-height: 32px;
+
+ &.vertical {
+ block {
+ min-width: 1px;
+ }
+
+ &.discrete block {
+ margin: 1px 0;
+ min-height: 32px;
+ }
}
- &.horizontal.discrete block { margin: 0 1px; }
- &.vertical.discrete block { margin: 1px 0; }
& block.filled.low {
border-color: darken($warning_color,10%);
background-color: $warning_color;
levelbar trough:backdrop { background-color: transparent; border-style: solid; background-image: linear-gradient(to bottom, #090909, #111 90%); color: #fff; background-image: linear-gradient(to bottom, #111, #111); box-shadow: 0 1px rgba(255, 255, 255, 0); }
-levelbar block { min-width: 32px; min-height: 1px; }
+levelbar.horizontal block { min-height: 1px; }
-levelbar.vertical block { min-width: 1px; min-height: 32px; }
+levelbar.horizontal.discrete block { margin: 0 1px; min-width: 32px; }
-levelbar.horizontal.discrete block { margin: 0 1px; }
+levelbar.vertical block { min-width: 1px; }
-levelbar.vertical.discrete block { margin: 1px 0; }
+levelbar.vertical.discrete block { margin: 1px 0; min-height: 32px; }
levelbar block.filled.low { border-color: #c26000; background-color: #f57900; }
levelbar trough:backdrop { background-color: transparent; border-style: solid; background-image: linear-gradient(to bottom, #f7f7f7, #fff 90%); color: #000; background-image: linear-gradient(to bottom, #fff, #fff); box-shadow: 0 1px rgba(255, 255, 255, 0); }
-levelbar block { min-width: 32px; min-height: 1px; }
+levelbar.horizontal block { min-height: 1px; }
-levelbar.vertical block { min-width: 1px; min-height: 32px; }
+levelbar.horizontal.discrete block { margin: 0 1px; min-width: 32px; }
-levelbar.horizontal.discrete block { margin: 0 1px; }
+levelbar.vertical block { min-width: 1px; }
-levelbar.vertical.discrete block { margin: 1px 0; }
+levelbar.vertical.discrete block { margin: 1px 0; min-height: 32px; }
levelbar block.filled.low { border-color: #c26000; background-color: #f57900; }